//
//  HX_TabBarController.m
//  07-Suger
//
//  Created by 韩旭 on 16/7/23.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "HX_TabBarController.h"
#import "HX_First.h"
#import "HX_Second.h"
#import "HX_Four.h"
#import "HX_Five.h"
#import "HX_Third.h"
@interface HX_TabBarController ()

@end

@implementation HX_TabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor cyanColor];
    
    [UINavigationBar appearance];
    // 通过appearance统一设置所有UITabBarItem的文字属性
    // 后面带有UI_APPEARANCE_SELECTOR的方法, 都可以通过appearance对象来统一设置
    HX_First *first = [[HX_First alloc] init];
   [self setChildVc:first title:@"df" image:@"" seleImage:@""];
    [self setChildVc:[[HX_Second alloc] init] title:@"fdf" image:nil seleImage:nil];
    [self setChildVc:[[HX_Third alloc] init] title:@"dfsf" image:nil seleImage:nil];
   [self setChildVc:[[HX_Four alloc] init] title:@"dfdssf" image:nil seleImage:nil];
    [self setChildVc:[[HX_Five alloc] init] title:@"dfsfdf" image:nil seleImage:nil];
}
- (void)setChildVc:(UIViewController *)childVc title:(NSString *)title image:(NSString *)image seleImage:(NSString *)seleImage {
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVc];
    childVc.navigationItem.title = title;
    nav.tabBarItem.title = title;
    childVc.tabBarItem.image = [UIImage imageNamed:image];
    childVc.tabBarItem.selectedImage = [UIImage imageNamed:seleImage];
  
    [nav.navigationBar setBarTintColor:[UIColor redColor]];
    [self addChildViewController:nav];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
